#ifndef _RING_BUFFER_H_
#define _RING_BUFFER_H_
#include <stdint.h>
#include <string.h>
#include <memory>


/**
* @brief:
* Ring buffer
*/
class CRingBuffer
{
public:
	CRingBuffer();
	~CRingBuffer();

	bool Create(int totalBytes);
	void Destroy();
	void Reset();
	bool Put(int size, const uint8_t *data);
	bool Get(int size, uint8_t *data);
	int Available();
	int Free();
	uint8_t Peek();
	uint8_t Peek(int pos);
	void Skip();
	void Skip(int cnt);

protected:
	int m_totalBytes;
	uint8_t *m_bufferPtr;
	int m_avail;
	int m_wpos;
	int m_rpos;
};


#endif

